/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package util;

import DAO.Parcours;
import DAO.Service;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.sql.Statement;
import java.util.List;
import java.util.logging.Level;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;
import org.hibernate.SQLQuery;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.primefaces.util.Base64;


@FacesConverter(value = "ParcoursConverter")
public class ProjectConverter implements Converter {

    @Override
    public Object getAsObject(FacesContext fc, UIComponent uic, String string) {

        Service service = new Service();
        int id = service.getIdParcours(string);
        Parcours parcours = service.getParcour(id);
        return parcours.getId();
    }

    @Override
    public String getAsString(FacesContext fc, UIComponent uic, Object o) {
        return o.toString();
    }
}
